package com.zzg.pattern.proxy.objectImpl;

import com.zzg.pattern.proxy.enumerate.ImageEnum;
import com.zzg.pattern.proxy.inter.ImageInter;
import com.zzg.pattern.proxy.inter.ObjectInter;
import com.zzg.pattern.proxy.inter.impl.JPGObject;
import com.zzg.pattern.proxy.inter.impl.PNGObject;

public class ImageObjectImpl implements ObjectInter {
	@Override
	public ImageInter getImageObject(String suffix){
		ImageInter obj = null;
		int index = ImageEnum.getIndexByName(suffix);
		if(ImageEnum.JPG.getIndex() == index){
			obj = new JPGObject();
		} else if(ImageEnum.PNG.getIndex() == index){
			obj = new PNGObject();
		}
		return obj;
	}
}
